#ifndef WARNINGINFORMATION_H
#define WARNINGINFORMATION_H

#include <QMainWindow>
#include<QFile>
#include <QDateTime>
#include <QDesktopServices>
#include <QUrl>
#include <QFileInfo>
#include<QTextStream>
#include <QTextCodec>
#include <QProcess>
namespace Ui {
class WarningInformation;
}
namespace WarningInformationWorckPlace
{
const QString WarningInformationFile = "F:\\Graduation_project\\WorkPlace\\work-place\\Vegetable_greenhouse_control_system\\WarningInformation.txt";
const QString programPath = "D:\\Program Files\\Notepad--\\Notepad--.exe"; // 替换为你的软件路径
};

class WarningInformation : public QMainWindow
{
    Q_OBJECT

public:
    explicit WarningInformation(QWidget *parent = nullptr);
    static WarningInformation* instance();
    ~WarningInformation();
    bool writeWarningInformation(QString enviromentalParameter="温度", QString reasonOfWarning="温度过低");//往日志文件中写
    void openWarningInformationFileExternal(const QString &filePath=WarningInformationWorckPlace::WarningInformationFile);//打开日志文件
    bool writePlainTextEdit(const QString &filePath=WarningInformationWorckPlace::WarningInformationFile);//往PliantextEdit控件中写日志

private slots:
    void handleWarningInformation(int index,int status);

    void on_pushButtonAlarmSoundSeting_clicked();

    void on_pushButtonClose_clicked();



    void on_pushButtonOPenWarningInformation_clicked();

    void on_pushButtonAlarmStatistics_clicked();
private:
    void initSensorWarningInformation(QVector<QVector<QString>>& Data);
private:
    Ui::WarningInformation *ui;
    QVector<QVector<QString>> Data;
};

#endif // WARNINGINFORMATION_H
